package top.zhangjianyong.test.thread;

import top.zhangjianyong.utils.coding.MD5Util;
import top.zhangjianyong.utils.net.HttpUtil;

import java.util.HashMap;
import java.util.Map;

public class TreeRunnable implements Runnable {

    private final static String baseUrl = "http://39.98.37.54:8088/notion-api";
    private String token;
    private String userId;

    public TreeRunnable(String token, String userId) {
        this.token = token;
        this.userId = userId;
    }

    @Override
    public void run() {

        Map map = new HashMap();
        map.put("version", "1.0");
        map.put("userId", userId);
        map.put("sign", MD5Util.crypt(map));
        Map cookie = new HashMap();
        cookie.put("token", token);
        String res = HttpUtil.sendPost(baseUrl + "/app/note/tree", map, cookie);
        System.out.println(userId+":\n"+res);

    }

    public static void main(String[] args) {
        TreeRunnable runnable =new TreeRunnable("zjy1994","150");
        Thread thread =new Thread(runnable);
        thread.start();
    }

}
